<?php
if (!defined('_CAN_LOAD_FILES_'))
	exit;
class TMHeaderLinks extends Module
{
	function __construct()
	{
		$this->name = 'tmheaderlinks';
		$this->tab = 'front_office_features';
		$this->version = 1.0;
		$this->author = 'PrestaShop';
		parent::__construct();
		
		$this->displayName = $this->l('TM Headerlinks');
		$this->description = $this->l('Adds a block that displays permanent links such as sitemap, contact, etc.');
	}
	function install()
	{
			return (parent::install() AND $this->registerHook('top'));
	}
	/**
	* Returns module content for header
	*
	* @param array $params Parameters
	* @return string Content
	*/
	function hookTop($params)
	{
		if (Configuration::get('PS_CATALOG_MODE'))
			return ;
		
		global $smarty, $cookie;
		
		if (Configuration::get('PS_PROMO_LOGO_CMS_ID'))
			$cms_promo = new CMS((int)(Configuration::get('PS_PROMO_LOGO_CMS_ID')), (int)($cookie->id_lang));
		
		if (Configuration::get('PS_NEWS_CMS_ID'))
			$cms_news = new CMS((int)(Configuration::get('PS_NEWS_CMS_ID')), (int)($cookie->id_lang));
			
			if (Configuration::get('PS_REFERRAL_CMS_ID'))
			$cms_referral = new CMS(10, (int)($cookie->id_lang));
		
		$smarty->assign(array(
			'cms_promo' => $cms_promo,
			'cms_news' => $cms_news,
			'cms_referral' => $cms_referral
		));
		
		return $this->display(__FILE__, 'tmheaderlinks.tpl');
	}
}